#ifndef WOLF_LAYER_HPP
#define WOLF_LAYER_HPP

#include "common.hpp"
namespace wolf {
/**
 * @brief Abstract layer to draw on screen.
 * @ingroup stdMod
 *
 *
 * Every displayable item on the engine should inherit from it.
 *  On the engine, the display (i.e. the screen surface.) is imagined as a
 *  blank desk. The layers are like papers that you can put on the desk.
 *  In each frame we put all the paper over the desk. If each one go to
 *  different positions, it would be OK, but if they fall on the same
 *  place we could have a problem: a important paper could be hidden if it
 *  is covered by a trivial paper.
 *
 * To you can avoid it, it is allowed to define the deep level of each frame.
 *  It defines the order of drawing, the deepest layer is draw first (the first
 *  paper to be put on the table) and the less deep is draw lastly (the last
 *  paper to be put on the table). If two layer draw things at same position, the
 *  most deep layer would be covered.
 *
 * Getting out of our metaphor, it is important to say that the base class just
 *  take care about the depth, but doesn't do anything about x or y axis. It has
 *  leaved to the derived class determine how do it.
 **/
class WOLF_DECLSPEC Layer {
public:
	/**
	 * @brief Creates a layer with the given depth
	 *
	 *
	 **/
	Layer(int depth, bool visible_ = true);

	/**
	 * @brief Destroys a layer
	 *
	 *
	 **/
	virtual ~Layer(void);

	/**
	 * @brief Returns the current depth
	 *
	 *
	 **/
	int getDepth(void);

	/**
	 * @brief Changes the current depth
	 *
	 *
	 **/
	void setDepth(int depth);

	/**
	 * @brief Draws the layer on the surface
	 *
	 * During the drawing, a implementation can use virtually all SDL functions,
	 *  but you should avoid the use of SDL_SetClipRect() and SDL_GetClipRect() on
	 *  dst parameter, because they may be called by the Engine::doFrame(). If you
	 *  @b really need to use that, just remember to save the previous clipping state
	 *  at the start and restore it at the end. Follow that model:
	 *  @code
	 *  void MyDerivedClass::draw(SDL_Surface *dst)
	 *  {
	 *     SDL_Rect backup;
	 *     SDL_GetClipRect(dst, &backup);
	 *
	 *     ...
	 *
	 *     // Your code here
	 *
	 *     ...
	 *
	 *     SDL_SetClipRect(dst, &backup);
	 *  }
	 *  @endcode
	 **/
	virtual void draw(SDL_Surface *dst) =0;

	/**
	 * @brief Gets the visibility.
	 * @return whether the layer is visible.
	 */
	bool isVisible() const;

	/**
	 * @brief Changes the visibility;
	 * @param visible true if you want to show the layer, false otherwise.
	 */
	void setVisible(bool visible);
private:
	int depth;
	bool visible;
};

}

#endif // WOLF_LAYER_HPP
